package com.example.Siki.DAO;

import com.example.Siki.pojo.Department;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

//部门Dao
public class DepartmentDao {
    //模拟数据库数据
    private static Map<Integer, Department> departmentMap = null;
    static {
        departmentMap = new HashMap<>();//创建部门表，模拟数据

        departmentMap.put(101,new Department(101,"部门1"));
        departmentMap.put(102,new Department(102,"部门2"));
        departmentMap.put(103,new Department(103,"部门3"));
        departmentMap.put(104,new Department(104,"部门4"));
        departmentMap.put(105,new Department(105,"部门5"));
    }

    public static Collection<Department> getDepartment(){
        return departmentMap.values();
    }

    //通过id获得部门
    public static Department selectDepartmentById(int id){
        return departmentMap.get(id);
    }
}
